package com.dabaozhan.modules.wx_app.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dabaozhan.common.utils.Utils;
import com.dabaozhan.modules.wx_app.dao.UserSiteMapper;
import com.dabaozhan.modules.wx_app.entity.UserSiteEntity;
import com.dabaozhan.modules.wx_app.service.UserSiteService;

/**
 * @author houzhong
 * @date 2018-12-25 14:26
 */
@Service("userSiteService")
public class UserSiteServiceImpl implements UserSiteService {

    @Autowired
    private UserSiteMapper userSiteMapper;

    @Override
    public int saveUserSite(UserSiteEntity v) {
        if (v.getId() == null) {
            v.setId(Utils.id().toString());
        }
        return userSiteMapper.save(v);
    }

    @Override
    public int updateUserSite(UserSiteEntity v) {
        return userSiteMapper.update(v);
    }

    @Override
    public UserSiteEntity findById(String id) {
        return userSiteMapper.getObjectById(id);
    }
}
